<div id="view-product">
    <div class="search-product">
        <div class="title"></div>
        <form action="" method="post">
            <fieldset>
                <legend>Tìm sản phẩm</legend>
                <div class="keyword"><input type="text" name="keyword" value=""/></div>
                <div class="select">
                    <select>
                    <option value="0">Tất cả các hãng...</option>
                    <?php foreach ($this->manu as $item){?>
                    <option value="<?php echo $item['manufacture_id']?>"><?php echo $item['manufacture_name']?></option>
                    <?php }?>
                    </select></div>
                <div class="search"><input type="button" value="Tìm"/></div>
            </fieldset>
        </form>
        <input type="button" class="search-all" value="Hiển thị tất cả"/>
    </div>
    
    <div class="all">
    
        <div class="clearb"></div>
    </div>
    <div class="add">
        <a class="add-product" href="<?php echo $this->baseUrl('admin/product/add')?>" title="Thêm">Thêm sản phẩm</a>
    </div>
</div>
<script>
$(document).ready(function(){
    var link = "<?php echo $this->url(array('module'=>'admin', 'controller'=>'product', 'action'=>'listall'))?>";
    $.get(link, null, function(rdata){
        $(".all").html(rdata);
        });	

//search
	$("#view-product .search input").click(function(){
	    var keyword = $("#view-product .keyword input").val();
	    var select = $("#view-product .select select").val();
	    data = {"param":{"keyword":keyword, "manu":select}};
	    
	    $.get(link, data, function(rdata){
		    $("#view-product .all").html(rdata);
		    });
		});
//show all
    $("#view-product input.search-all").click(function(){
        $.ajax({
            url: link,
            success: function(rdata){
                $("#view-product .all").html(rdata);
            }
        });
    });
});
</script>